<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>vue学习</title>

	</head>
	<body>
		<div id="app">
			<!--  #app是Vue实例挂载的元素，应该在挂载元素范围内使用组件-->
			<button-counter></button-counter>
			<button-counter></button-counter>
			<button-counter></button-counter>
		</div>
		<script src="js/vue.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			// 1.创建一个组件构造器
			// var myComponent = Vue.extend({
			// 	template:`<div>Fist</div>`
			// })
			Vue.component('button-counter', {
				data: function() {
					return {
						count: 0
					}
				},

				template: '<button @click="count++">点击{{count}}次</button>'
			})
			// 2.注册组件，并指定组件的标签，组件的HTML标签为<my-component>
			//Vue.component('my-component',myComponent)
			new Vue({
				el: '#app'
				/* components:{
					'my-component': myComponent
				} */
			})
		</script>

	</body>
</html>
